# -*- coding: UTF-8 -*-
# import asyncio
# import random
# import aiohttp
# import requests
# import re
#
# from DrissionPage import SessionPage
# from urllib.parse import urlparse
# from loguru import logger
#
#
# async def func1():
#     return random.randint(1, 4)
#
#
# async def func3():
#     return random.randint(4, 8)
#
#
# async def func2(number):
#     tasks = [func1() for _ in range(number)]
#     results = await asyncio.gather(*tasks)
#     await asyncio.sleep(3)
#     result2 = await asyncio.gather(*[func3() for _ in range(number)])
#     print(results, result2)
#
#
# async def req():
#     url = "https://mmbiz.qlogo.cn/mmbiz_jpg/Rp4HdscxFM26xsnNSexho7LynRp3iaoon9icxn1SEaLeBu6h2SuF2yU3gfRiaNDEwHucorU0sGo2Q7lB6XCecBFRg/0?wx_fmt=jpeg"
#     async with aiohttp.ClientSession() as session:
#         async with session.get(url) as response:
#             print(response.headers.get("Content-Type"))
# from cgitb import reset
# from urllib.parse import urlparse

import requests
# if __name__ == '__main__':
#     asyncio.run(req())

# a = "http://www.lfxybb.com"
# b = "https://www.baidu.com"
# s = SessionPage()
# s.get(a, allow_redirects=False)
# print(s.ele('xpath://head/title'))
# print(s.url)
# # print(s.html)
# print(s.response.status_code)
# resp = requests.get(a)
# print(resp.headers)

from PIL import Image
from io import BytesIO
from DrissionPage import SessionPage

# import base64

# aaa = ""
# decode = base64.b64decode(aaa.split(",")[1])
#
# a = "https://mmbiz.qpic.cn/mmbiz_png/gck7juW9R3I6xWMwicJCZL33Vq7jVFVD6yWtK70Lf8QVp4qDxo7jPGyo40mSPYUoIm0JmytzRPOdVAxq7xXtT6Q/640?wx_fmt=other&wxfrom=5&wx_lazy=1&wx_co=1&tp=webp"
# b = "https://mmbiz.qpic.cn/mmbiz_png/tmTlWM9AU9IbnXrgbzcOJGhNVsSh2uoywh8T5GibvugZToiaEg5XbjQxEDHiaU2XVMlOHRicN3qPUOnr1k6FFHRnqw/0?wx_fmt=png"
# c = "https://mmbiz.qpic.cn/mmbiz_png/gck7juW9R3I6xWMwicJCZL33Vq7jVFVD6QnbaA5FIbIHPenqHibn5OIgcX5W89C9KV735T9szZriaMOumcTA2WDdA/640?wx_fmt=other&wxfrom=5&wx_lazy=1&wx_co=1&tp=webp"
# d = "https://img.iapply.cn/83a9cac9d2e18ed1e2466656f8bbd5e1"
#
# print('image/png' in 'image/png; charset=utf-8')
# print(requests.get(d).content[:8])
# response = requests.get(d)
# print(response.headers)
# with Image.open(BytesIO(decode)) as img:
#     print(img.format.lower())

# a = "http://sangongchina.com/"
# print(requests.get(a).text)
# logger.info("this is test info")

# from concurrent.futures import ThreadPoolExecutor
# import os
# import time
#
#
# def task(n):
#     print(f"Task {n} is running on thread {os.getpid()}")
#     time.sleep(1)
#     return f"Result {n}"
#
#
# with ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
#     # 第一次提交任务
#     futures1 = [executor.submit(task, i) for i in range(5)]
#
#     # 等待第一次提交的任务完成
#     for future in futures1:
#         print(future.result())
#
#     # 第二次提交任务
#     futures2 = [executor.submit(task, i + 5) for i in range(5)]
#
#     # 等待第二次提交的任务完成
#     for future in futures2:
#         print(future.result())
#
#
# executor.submit(task, 4)

# print("123" in ["123", "456", 1, 12, 3])
# aa = "http://hb0418310ah8.bdy.pgdns.cn/index.php?m=cn&c=Honor&a=view&id=98"

# ss = SessionPage()
# ss.get(aa)
# ss.ele("@tag()=a")
# print(ss.response is None)
# print(ss.response)

# tt = "http://www.hengrenwood.cn/tel:15127690110"
# url_pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
# print(re.match(url_pattern, ss))
# ss = SessionPage()
# ss.get(aa)
# print(ss.response.status_code)
# print(ss.title)
# from fake_useragent import UserAgent

# hh = "https://changji.baixing.com/"
# resp = requests.get(hh, headers={"user-agent": UserAgent().random}
#                     , allow_redirects=True)
# resp.raise_for_status()
# print(resp.text)
# print(resp.status_code)
# id = resp.cookies.get("__trackId")
# resp = requests.get(hh, headers={"user-agent": UserAgent().random}
#                     , allow_redirects=True, cookies={"__trackId": id})
# print(resp.text)

# s = requests.Session()
# s.get(hh)
# resp = s.get(hh)
# print(resp.text)

aaa = "http://bys.gxrc.com/Content/Images/index_jy05.jpg?v=2020"
bbb = "https://logo.gxrc.com/Logo/c945322c-a7d2-4039-a6fd-d45ee087856b/huaming.png"

# resp = requests.get(bbb)
# print(resp.headers)
# print(Image.open(BytesIO(resp.content)).mode)

if (1 == 2 or True) and True:
    print("ok")
